//
//  Product_Information_ViewController.m
//  Pacific_Computer
//
//  Created by dlios on 14-12-20.
//  Copyright (c) 2014年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "Product_Information_ViewController.h"

@interface Product_Information_ViewController ()<UIWebViewDelegate>

@property (nonatomic,retain) UIWebView *web;
@property (nonatomic,retain) UIView *loading;
@property (nonatomic,retain) UIActivityIndicatorView *actView;

@end

@implementation Product_Information_ViewController

- (void)dealloc
{
    [_actView release];
    [_loading release];
    [_web release];
    [_inform release];
    [super dealloc];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.navigationController.navigationBar.barTintColor = [UIColor whiteColor];
    
    self.web = [[UIWebView alloc] initWithFrame:CGRectMake(0, -self.view.bounds.size.height * 26 / 100, self.view.bounds.size.width, self.view.bounds.size.height * 1.309)];
    self.web.delegate = self;
    [self.view addSubview:self.web];
    
    NSString *str = self.inform.url;
    str = [str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSURL *url = [NSURL URLWithString:str];
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60];
    [self.web loadRequest:request];
    [_web release];
    
    self.loading = [[UIView alloc] initWithFrame:CGRectMake(0, self.view.bounds.size.height * 9.59 / 100, self.view.bounds.size.width, self.view.bounds.size.height * 92.65 / 100)];
    self.loading.backgroundColor = [UIColor blackColor];
    self.loading.alpha = 0.5;
    [self.view addSubview:self.loading];
    [_loading release];
    
    
    
    
    
}

- (void)webViewDidStartLoad:(UIWebView *)webView
{
    self.actView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
    self.actView.frame = CGRectMake(self.view.bounds.size.width * 46.66 / 100, self.view.bounds.size.height * 29.98, self.view.bounds.size.width * 6.666 / 100, self.view.bounds.size.height * 3.748 / 100);
    [self.loading addSubview:self.actView];
    self.actView.center = self.loading.center;
    [self.actView startAnimating];
    [_actView release];
}

- (void)webViewDidFinishLoad:(UIWebView *)webView
{
    [self.actView stopAnimating];
    [self.loading removeFromSuperview];
}

- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
    [self.actView stopAnimating];
    [self.loading removeFromSuperview];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
